﻿#include <iostream>
#include "RBTree.h"
using namespace std;
int main()
{
	Node<char, int> node1('a', 'a',true);
	Node<char, int> node2('b', 'b', true);
	Node<char, int> node3('c', 'c', true);
	Node<char, int> node4('d', 'd', true);
	Node<char, int> node5('e', 'e', true);
	Node<char, int> node6('f', 'f', true);
	Node<char, int> node7('g', 'g', true);
	Node<char, int> node8('h', 'h', true);
	Node<char, int> node9('i', 'i', true);
	Node<char, int> node10('i', 999, true);
	Node<char, int>* tempNode = new Node<char, int>;
	RBTree<char, int>* tree = new RBTree<char, int>();
	tree->insert(node7);
	tree->insert(node1);
	tree->insert(node2);
	tree->insert(node4);
	tree->insert(node3);
	tree->insert(node9);
	tree->insert(node8);
	tree->insert(node5);
	tree->insert(node6);
	tree->ascend();
	cout << endl;
	tempNode = tree->find(node5.getName());
	cout << "name = " << tempNode->getName() << "   value = " << tempNode->getValue() << "   color = " << tempNode->getColor() << endl;
	tree->erase('i');
	tree->erase('d');
	tree->insert(node10);
//	tree->erase('f');
//	tree->erase('b');
	tree->myinOrderTraverse(tree->getRoot());
	return 0;
}
